home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / symm.md / userSysCallInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-10  |  2.6 KB  |  85 lines

  1. /*|*
  2. |* userSysCallInt.h --
  3. |*
  4. |*     Contains macro for stubs for user-level system calls.
  5. |*
  6. |* Copyright 1985, 1988 Regents of the University of California
  7. |* Permission to use, copy, modify, and distribute this
  8. |* software and its documentation for any purpose and without
  9. |* fee is hereby granted, provided that the above copyright
  10. |* notice appear in all copies.  The University of California
  11. |* makes no representations about the suitability of this
  12. |* software for any purpose.  It is provided "as is" without
  13. |* express or implied warranty.
  14. |*
  15. |* rcs = $Header: /crg2/bruces6/sprite/src/lib/c/syscall/sym.md/RCS/userSysCallInt.h,v 1.1 90/01/19 10:19:41 fubar Exp $ SPRITE (Berkeley)
  16. |*
  17. */
  18.  
  19. #include "kernel/sysSysCall.h"
  20. #include "kernel/machAsmDefs.h"
  21. #include "kernel/machTrap.h"
  22. #ifndef _USERSYSCALLINT
  23. #define _USERSYSCALLINT
  24. /*
  25.  * ----------------------------------------------------------------------------
  26.  *
  27.  * SYS_CALL --
  28.  *
  29.  *      Define a user-level system call.  The call sets up a trap into a 
  30.  *    system-level routine with the appropriate constant passed as
  31.  *     an argument to specify the type of system call.
  32.  * ----------------------------------------------------------------------------
  33.  */
  34.  
  35.  
  36. /*
  37.  * These are different in usage than in Dynix!  'c' is a constant,
  38.  * not the syscall name.
  39.  */
  40. #define SVC0(s,c)         movl $0, %ecx; SVC(0,c)
  41. #define SVC1(s,c)         leal SPARG0, %ecx; SVC(1,c)
  42. #define SVC2(s,c)         leal SPARG0, %ecx; SVC(2,c)
  43. #define SVC3(s,c)         leal SPARG0, %ecx; SVC(3,c)
  44. #define SVC4(s,c)         leal SPARG0, %ecx; SVC(4,c)
  45. #define SVC5(s,c)         leal SPARG0, %ecx; SVC(5,c)
  46. #define SVC6(s,c)         leal SPARG0, %ecx; SVC(6,c)
  47. #define SVC7(s,c)         leal SPARG0, %ecx; SVC(7,c)
  48. #define SVC8(s,c)         leal SPARG0, %ecx; SVC(8,c)
  49. #define SVC9(s,c)         leal SPARG0, %ecx; SVC(9,c)
  50. #define SVC10(s,c)        leal SPARG0, %ecx; SVC(10,c)
  51.  
  52. /*
  53.  * Actual SYS_CALL definition differs from normal Sprite definition:
  54.  * Normal sprite def is "SYS_CALL(name, constant)"
  55.  * our definition is "SYS_CALL(argcount, name, constant)"
  56.  */
  57.  
  58. #define SYS_CALL(a,s,c)    ENTRY(s); SVC/**/a(s,c); RETURN
  59.  
  60. /* 
  61.  * If we want to use the Dynix "SYS_REL" system call version
  62.  * stuff, it'll go in here.  For now, forget about it.
  63.  *
  64.  * n == number of args,
  65.  * c == system call number.
  66.  */
  67. #define SVC(n,c)    movl $c, %eax; int $T_SPRITE_SYSCALL
  68.  
  69.  
  70. #ifdef noway
  71. /* this will just cause a breakpoint trap, with the syscall number
  72.  * in %eax.
  73.  */
  74. #define SYS_CALL(name, constant) \
  75.     .text; \
  76.     .align 2; \
  77.     .globl _/**/name; _/**/name: \
  78.     movl $constant, %eax; \
  79.     int $3;
  80.  
  81. #endif _USERSYSCALLINT
  82.  
  83.  
  84. #endif /* noway */
  85.